from google.appengine.ext import db

class Link(db.Model):
    original_link = db.StringProperty(required=True, multiline=True)
    updated_link = db.StringProperty(required=True, multiline=True)
    original_status_id = db.IntegerProperty(required=False)
    updated_status_id = db.IntegerProperty(required=False)
    
    @staticmethod
    def get_by_updated_status_id(updated_status_id):
        link = Link.gql(
            "WHERE updated_status_id = :updated_status_id",
            updated_status_id = updated_status_id).get()
        return link
        

    @staticmethod
    def insert(original_link, updated_link, 
               original_status_id, updated_status_id):
        link = Link(original_link = original_link,
                    updated_link = updated_link,
                    original_status_id = original_status_id,
                    updated_status_id = updated_status_id)
        link.put()
        return link